package com.epam.cdp.web;

import javax.ejb.EJB;

import com.epam.cdp.ejb.singletons.Printer;

public class SingletonExampleBackingBean {
	@EJB
	private Printer printer;

	private String lastPrintingStatus;
	
	public Printer getPrinter() {
		return printer;
	}

	public void setPrinter(Printer printer) {
		this.printer = printer;
	}
	
	public void print() {
		if (printer.print()) {
		    lastPrintingStatus = "Printed";
		} else {
		    lastPrintingStatus = "Error!";
		}
	}

	public String getLastPrintingStatus() {
	    return lastPrintingStatus;
	}

	public void setLastPrintingStatus(String lastPrintingStatus) {
	    this.lastPrintingStatus = lastPrintingStatus;
	}
	
	public int getCalloutNumber() {
	    return printer.getCalloutNumber();
	}
	
}
